import { spawn,execSync } from 'child_process'  
import path from 'node:path'  
const currentWorkingDirectory = process.cwd(); 
const packageDirectory = path.resolve(currentWorkingDirectory, 'test'); // 指定目录的绝对路径
// const npmProcess = spawn('npm', ['install'], {
//   cwd: packageDirectory
// });
  
// npmProcess.stdout.on('data', (data) => {
//   console.log(`stdout: ${data}`);
// });
  
// npmProcess.stderr.on('data', (data) => {
//   console.error(`stderr: ${data}`);
// });
  
// npmProcess.on('close', (code) => {
//   console.log(`child process closed with code ${code}`);
// });
const init = async  () =>{
  // await execSync('cd test')
  await execSync('npm install',{  
    cwd: packageDirectory,  
    stdio: 'inherit' // 继承父进程的 stdio，以便看到输出  
  })
}
init()